package ch02;

/**
 * @Author lzp
 * @Date 2024-04-02
 */
public class test01 {
    public static void main(String[] args) {

        //获取操作类的 class
        Animal obj = new Animal();
        Class<? extends Animal> clazz = obj.getClass();

        // 判断是否存在某注解
        boolean bl2 = clazz.isAnnotationPresent(Hello.class) ;
        System.out.println(bl2);

        //获取注解对象
        Hello annotation = clazz.getAnnotation(Hello.class);

        //获取注解的值
        String value = annotation.value();

        //对注解的值进行处理
        if("hello".equals(value)){
            System.out.println("此动物来自中国");
        }else {
            System.out.println("此动物来自中国");
        }
        System.out.println(value);


    }
}
